package com.gxa.service.investment.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gxa.dto.investmentDto.CompanyQuitDto;
import com.gxa.dto.investmentDto.CompanyQuitResult;
import com.gxa.entity.investment.Company;
import com.gxa.entity.investment.CompanyQuit;
import com.gxa.mapper.investment.CompanyQuitMapper;
import com.gxa.service.investment.CompanyQuitService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 退园管理 服务实现类
 * </p>
 *
 * @author yjl
 * @since 2022-10-16 11:39:46
 */
@Service
public class CompanyQuitServiceImpl extends ServiceImpl<CompanyQuitMapper, CompanyQuit> implements CompanyQuitService {

    @Autowired
    private CompanyQuitMapper companyQuitMapper;
    @Override
    public int add(CompanyQuit companyQuit) {
        return companyQuitMapper.insert(companyQuit);
    }

    @Override
    public int delete(Integer id) {
        return companyQuitMapper.deleteById(id);
    }

    @Override
    public CompanyQuitResult queryById(Integer id) {
        return companyQuitMapper.queryById(id);
    }

    @Override
    public List<CompanyQuit> seletAll() {
        return companyQuitMapper.selectList(null);
    }

    @Override
    public int update(CompanyQuit companyQuit) {
        return companyQuitMapper.updateById(companyQuit);
    }

    @Override
    public PageInfo<CompanyQuitResult> queryByCompanyQuitDto(CompanyQuitDto companyQuitDto, Integer pageNum, Integer pageSize) {
        Page<CompanyQuitResult> page = PageHelper.startPage(pageNum,pageSize);
        List<CompanyQuitResult> companyQuitResultList = this.companyQuitMapper.queryByCompanyQuitDto(companyQuitDto);
        PageInfo<CompanyQuitResult> pageInfo = new PageInfo<>(companyQuitResultList);

        return pageInfo;
    }

    @Override
    public List<CompanyQuitResult> selectAll() {
        return companyQuitMapper.selectAll();
    }

}
